package cn.gyx.hrm.fegin.client;

import cn.gyx.hrm.doc.CourseDoc;
import cn.gyx.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class CourseESFeignClientfallbackFactory implements FallbackFactory<CourseESFeignClient>{
    @Override
    public CourseESFeignClient create(Throwable throwable) {
        return new CourseESFeignClient() {
            @Override
            public AjaxResult save(CourseDoc course) {
                log.error("服务降级{}", throwable.getMessage());
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("System Failure!!!");
            }

//            @Override
//            public AjaxResult deleteById(Long id) {
//                log.error("服务降级{}", throwable.getMessage());
//                throwable.printStackTrace();
//                return AjaxResult.me().setSuccess(false).setMessage("System Failure!!!");
//            }
        };
    }
}
